package tt.dz.order.pojo;

import java.util.HashMap;
import java.util.Map;

import tt.dz.order.dao.BaseDAOUtil;

/**
 * 订单修改日志
 * 
 * @author NIBO
 *
 */
public class OrderInfoChangeLogInfo extends OrderInfo {
	private static final String SELECT_ALL_SQL = "select service.name as serviceName,changeId,orderNo, relatedOrderNo, info.serviceNo, userId, userType, cardNo, cardType, payerBalance, appId, activityRule, caculatedTotalPrice, realPayer, realReceiver, payTypeCode, payChannelCode, thdPaySeq, thdPayAmount, thdPoundage, thdEndTime, tradeStatusCode, status, info.createTime , orderType, stage  from order_info_change_log info INNER JOIN order_service_info service ON service.serviceno=info.serviceno ";
	private String changeId;
	private String serviceName;
	private String statusName;
	private String userTypeName;


	public String getChangeId() {
		return changeId;
	}


	public void setChangeId(String changeId) {
		this.changeId = changeId;
	}


	public String getServiceName() {
		return serviceName;
	}


	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}


	public String getStatusName() {
		return statusName;
	}


	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}


	public String getUserTypeName() {
		return userTypeName;
	}


	public void setUserTypeName(String userTypeName) {
		this.userTypeName = userTypeName;
	}


	@Override
	public void save() {
		String sql = "insert into order_info_change_log(changeId,orderNo, relatedOrderNo, serviceNo, userId, userType, cardNo, cardType, payerBalance, appId, activityRule, caculatedTotalPrice, realPayer, realReceiver, payTypeCode, payChannelCode, thdPaySeq, thdPayAmount, thdPoundage, thdEndTime, tradeStatusCode, status, createTime,orderType,stage) values(:changeId,:orderNo, :relatedOrderNo, :serviceNo, :userId, :userType, :cardNo, :cardType, :payerBalance, :appId, :activityRule, :caculatedTotalPrice, :realPayer, :realReceiver, :payTypeCode, :payChannelCode, :thdPaySeq, :thdPayAmount, :thdPoundage, :thdEndTime, :tradeStatusCode, :status, :createTime,:orderType,:stage)";
		BaseDAOUtil.updateObject(sql, this);
	}
	public static OrderInfoChangeLogInfo queryByChangeId(String changeId) {
		String sql=SELECT_ALL_SQL+" where changeId = :changeId";
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("changeId", changeId);
		return BaseDAOUtil.queryForObject(sql, paramMap, OrderInfoChangeLogInfo.class);
	}
	
}
